#include <dbg.h>
#include <gtest/gtest.h>
using namespace std;

class Solution {
public:
    long long getDescentPeriods(vector<int>& prices) {
        long long res = 1;

        int cnt = 1;
        for (int i = 1; i < prices.size(); ++i) {
            if (prices[i] == prices[i - 1] - 1) {
                ++cnt;
            } else {
                cnt = 1;
            }
            res += cnt;
        }
        return res;
    }
};

TEST(TEST1, getDescentPeriods) {
    Solution s;

    vector<int> prices = {3, 2, 1, 4};
    EXPECT_EQ(s.getDescentPeriods(prices), 7);
}

TEST(TEST2, getDescentPeriods) {
    Solution s;

    vector<int> prices = {8, 6, 7, 7};
    EXPECT_EQ(s.getDescentPeriods(prices), 4);
}

TEST(TEST3, getDescentPeriods) {
    Solution s;

    vector<int> prices = {1};
    EXPECT_EQ(s.getDescentPeriods(prices), 1);
}

int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}